//
// Created by ze on 2023/11/9.
//

#include "UPRE_GLOBAL_DEFINE.h"
#include "UPRE_GYRO100A.h"
#include "UPRE_PID.h"
#include "UPRE_LOCATION.h"
#include "can.h"
#include "tim.h"
#include "UPRE_AirCylinder.h"
extern   uint8_t recbuff[100];
int _write(int file, char *data, int len)
{
    HAL_UART_Transmit(&huart1, (uint8_t*)data, len, HAL_MAX_DELAY);
    return len;
}
void Robot_Init()
{
    //蓝牙初始化
    __HAL_UART_ENABLE_IT(&huart3,UART_IT_IDLE);  //开启中断
    HAL_UART_Receive_DMA(&huart3,recbuff,100);  //使能新的接收
    //陀螺仪初始化
    GYRO_A100_Init();
    //PID初始化
    pidInit();

    //全场定位编码器初始化
    HAL_TIM_Encoder_Start(&htim1,TIM_CHANNEL_ALL);
    HAL_TIM_Encoder_Start(&htim3,TIM_CHANNEL_ALL);
    Location_Init();
    //电机初始化
    Motor_Init();
    //电机初始化不工作
//    Motor_DisInit();
    // 气缸初始化l


}